Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry role assignment creation #1644

Closed
wants to merge 1 commit into from
Closed

retry role assignment creation #1644

wants to merge 1 commit into from

Conversation

joakimhellum
Copy link

@joakimhellum joakimhellum commented Jul 25, 2018

#1635
Would like to start discussion how to possibly implement workaround for this issue.

@TechyMatt
Copy link
Contributor

Hey, I implemented a new statement as follows in resourceArmRoleAssignmentCreate, however it doesn't look to wait because the check passes and it gets the ID back, which I kinda expected as it's returning when the creation is down. I think the retry is going to need to be placed on the following:

_, err = roleAssignmentsClient.Create(ctx, scope, name, properties)

Here is my hack about so far which is similar to @joakimhellum-in has committed so far:

	err :=  resource.Retry(120*time.Second, validatePrincipalIdExists(principalId, meta))
	if err != nil {
		return err
	}
func validatePrincipalIdExists(principalId string, meta interface{}) func() *resource.RetryError {
	
	return func() *resource.RetryError {
		servicePrincipalsClient := meta.(*ArmClient).servicePrincipalsClient
		ctx := meta.(*ArmClient).StopContext
		
		_, err := servicePrincipalsClient.Get(ctx, principalId)

		if err != nil {
			return resource.RetryableError(err)
		}
		return nil
		
	}
}

@TechyMatt
Copy link
Contributor

I submitted PR #1647 with a tested solution.

@joakimhellum
Copy link
Author

thanks alot. i will close this one in favor of #1647
@mb290 @tombuildsstuff FYI did create some hundred service principals past week and found that 2 minutes might be enough (as opposed to 3min). not sure if you got the same results.

@joakimhellum joakimhellum deleted the retry-role-assignment branch August 1, 2018 07:41
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants